﻿using UnityEngine;
using System.Collections;
using System;
public class SsjjPay:SingleClass<SsjjPay>
{


	public SsjjPay ()
	{
		
	}
	static Action<bool> FinishTodo = null;

	public void Init (params string[] key)
	{
		Debug.Log ("YXC" + "  Call 4399 init  id=" + key [0] + " GameName =" + key [1]);
		SsjjCallAndroid.Init (key [0], key [1]);
	}


	/// <summary>
	/// 4399的支付
	/// </summary>
	/// <param name="moneyAmount">支付金额(元)</param>
	/// <param name="productName">显示在支付页面的商品名称</param>
	public void Pay (string moneyAmount, string productName, Action<bool> ac)
	{
		if (ac != null) {
			FinishTodo = ac;
		} else {
			FinishTodo = null;
		}
		Debug.Log ("YXC" + "  Call  4399Pay  ");
		SsjjCallAndroid.Pay (moneyAmount, productName);
	}

	public void PayCallback (string result)
	{
		Debug.Log ("YXC" + "  回调信息  " + result);
		//支付成功处理事件
		if ("0" == result) {
			//			ShopMgr.instance.PayCallBack (0);
			if (FinishTodo != null) {
				FinishTodo (true);
			}
			Debug.Log ("YXC" + "  zhifuchengggong  ");
		}
		//支付失败处理事件
		else if ("1" == result) {
			if (FinishTodo != null) {
				FinishTodo (false);
			}
			Debug.Log ("YXC" + "  zhifushibai  ");
			//			ShopMgr.instance.PayCallBack (1);
		}

	}
}
